local jijiu = fk.CreateSkill {
  name = "lingling__jijiu",
}

Fk:loadTranslationTable{
  ["lingling__jijiu"] = "急救",
  [":lingling__jijiu"] = "你可以将红色牌当【桃】使用。若你于回合内对濒死角色使用【桃】，则回复值改为2点。",

  ["#lingling__jijiu"] = "急救：你可以将红色牌当【桃】使用",
}

jijiu:addEffect("viewas", {
  anim_type = "support",
  pattern = "peach",
  prompt = "#lingling__jijiu",
  handly_pile = true,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).color == Card.Red
  end,
  view_as = function(self, player, cards)
    if #cards ~= 1 then return end
    local c = Fk:cloneCard("peach")
    c.skillName = jijiu.name
    c:addSubcard(cards[1])
    return c
  end,
  enabled_at_response = function(self, player, response)
    return not response
  end,
})

jijiu:addEffect(fk.PreHpRecover, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(jijiu.name) and
      data.recoverBy == player and player.room.current == player and
      target.dying and data.card and data.card.trueName == "peach"
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    data:changeRecover(2 - data.num)
  end,
})

jijiu:addAI(nil, "vs_skill")

return jijiu
